<#ibizinclude>
../../@MACRO/LANG_FUN.ftl
</#ibizinclude>
<#assign ctrl_base_name = "EditFormControlBase"/>
<#assign import_block>
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
</#assign>
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_HEADER-BASE.vue.ftl
</#ibizinclude>
<#ibizinclude>
../@MACRO/FUNC/MACRO.ftl
</#ibizinclude>

<#--  计算关系界面数量  -->
<#assign drCount = 0>
<#list ctrl.getAllPSDEFormDetails() as formdetail>
<#if formdetail.getDetailType() == "DRUIPART">
<#assign drCount += 1>
</#if>
</#list>
<#if drCount gt 0>

    /**
     * 关系界面数量
     *
     * @protected
     * @type {number}
     * @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
     */
    protected drCount: number = ${drCount};
</#if>
<#list ctrl.getPSDEFormItems() as formitem>
<#if formitem.getPSAppDEField?? && formitem.getPSAppDEField()??>
<#if !formitem.isHidden() && formitem.getPSAppDEField().isKeyField()>

    /**
     * 主键表单项名称
     *
     * @protected
     * @type {number}
     * @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
     */
    protected formKeyItemName: string = '${formitem.getName()}';
</#if>
</#if>
</#list>
    /**
     * 表单数据对象
     *
     * @type {*}
     * @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
     */
    public data: any = {
        <#list ctrl.getPSDEFormItems() as item>
        ${item.getName()}: null,
        </#list>
        ${ctrl.getPSAppDataEntity().getCodeName()?lower_case}:null,
    };

    /**
     * 主信息属性映射表单项名称
     *
     * @type {*}
     * @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
     */
    public majorMessageField: string = "<#list ctrl.getAllPSDEFormDetails() as item><#if item.getDetailType()?? && item.getDetailType() == "FORMITEM" && !item.isHidden()><#if item.getPSAppDEField?? && item.getPSAppDEField()?? && item.getPSAppDEField().isMajorField()>${item.getName()}</#if></#if></#list>";

    /**
     * 属性值规则
     *
     * @type {*}
     * @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
     */
    public rules():any{
        return {
        <#list ctrl.getAllPSDEFormDetails() as formdetail>
        <#-- 表单项 start -->
        <#if formdetail.getDetailType?? && formdetail.getDetailType() == 'FORMITEM' && formdetail.getEditorType() != "HIDDEN" && formdetail.isCompositeItem?? && !formdetail.isCompositeItem()>
<#assign itemRuleCount = 0/>
<#if ctrl.getPSDEFormItemVRs()??>
    <#list ctrl.getPSDEFormItemVRs() as fideValueRule>
        <#if fideValueRule.getPSDEFormItemName()?lower_case == formdetail.getName()?lower_case >
            <#if fideValueRule.getPSSysValueRule()??>
            <#assign  valueRule = fideValueRule.getPSSysValueRule()/>
                <#if valueRule.getRuleType?? && valueRule.getRuleType()??>
                    <#if valueRule.getRuleType() == "REG">
                        <#assign itemRuleCount += 1/>
                    <#elseif valueRule.getRuleType() == "SCRIPT">
                        <#assign itemRuleCount += 1/>
                    </#if>
                </#if>
            </#if>
            <#if fideValueRule.getCheckMode?? && fideValueRule.getCheckMode()?? && fideValueRule.getCheckMode() != 2 && fideValueRule.getPSDEFValueRule?? && fideValueRule.getPSDEFValueRule()??>
                <#assign itemRuleCount += 1/>
            </#if>
        </#if>
    </#list>
</#if>
<#if itemRuleCount gt 0 || formdetail.isAllowEmpty() == false>
        ${formdetail.getName()}: [
<#if formdetail.isAllowEmpty() == false>
            { required: this.detailsModel.${formdetail.getName()}.required, type: '<#assign datatype=srfjavatype(formdetail.getStdDataType())><#if datatype=='BigInteger' || datatype=='Integer' || datatype=='Double' || datatype=='Decimal' || datatype=='Float' || datatype=='BigDecimal'>number<#else>string</#if>', message: '${formdetail.getCaption()} 值不能为空', trigger: 'change' },
            { required: this.detailsModel.${formdetail.getName()}.required, type: '<#assign datatype=srfjavatype(formdetail.getStdDataType())><#if datatype=='BigInteger' || datatype=='Integer' || datatype=='Double' || datatype=='Decimal' || datatype=='Float' || datatype=='BigDecimal'>number<#else>string</#if>', message: '${formdetail.getCaption()} 值不能为空', trigger: 'blur' },
</#if>
             <#if formdetail.getEditorType?? && formdetail.getEditorType()?? &&  formdetail.isAllowEmpty?? && formdetail.isAllowEmpty()??>
            <#if  formdetail.getEditorType() == 'CHECKBOX' &&  !formdetail.isAllowEmpty()>
            { validator: (rule:any, value:any, callback:any) => { 
                if(rule.required && value != 1){
                   return false;
                }else{
                   return true;
                }
              }, message: '${formdetail.getCaption()} 必须填写', trigger: 'change' ,required:true}
            </#if>
            </#if>
          <#if ctrl.getPSDEFormItemVRs()??>
            <#list ctrl.getPSDEFormItemVRs() as fideValueRule>
            <#if fideValueRule.getPSDEFormItemName()?lower_case == formdetail.getName()?lower_case >
                <#-- 系统值规则 -->
              <#if fideValueRule.getPSSysValueRule()??>
                <#assign  valueRule = fideValueRule.getPSSysValueRule()/>
                <#if valueRule.getRuleType?? && valueRule.getRuleType()??>
                  <#if valueRule.getRuleType() == "REG">
            { <#if valueRule.getRegExCode?? && valueRule.getRegExCode()??>pattern: /${valueRule.getRegExCode()}/</#if><#if valueRule.getRuleInfo?? &&  valueRule.getRuleInfo()??>, message: '${valueRule.getRuleInfo()}'</#if>, trigger: 'change' },
                  <#elseif valueRule.getRuleType() == "SCRIPT">
            { <#if valueRule.getScriptCode?? && valueRule.getScriptCode()??>validator: (rule:any, value:any, callback:any) => { ${valueRule.getScriptCode()} }</#if><#if valueRule.getRuleInfo?? &&  valueRule.getRuleInfo()??>, message: '${valueRule.getRuleInfo()}'</#if>, trigger: 'change' },
                  </#if>
                </#if>
              </#if>
              <#-- 属性值规则 -->
              <#if fideValueRule.getCheckMode?? && fideValueRule.getCheckMode()?? && fideValueRule.getCheckMode() != 2 && fideValueRule.getPSDEFValueRule?? && fideValueRule.getPSDEFValueRule()??>
                <#assign  deRule = fideValueRule.getPSDEFValueRule()/>
            {validator:(rule:any, value:any)=>{return this.verifyDeRules("${fideValueRule.getPSDEFormItemName()?lower_case}").isPast},message: this.verifyDeRules("${fideValueRule.getPSDEFormItemName()?lower_case}").infoMessage, trigger: 'change' },
            {validator:(rule:any, value:any)=>{return this.verifyDeRules("${fideValueRule.getPSDEFormItemName()?lower_case}").isPast},message: this.verifyDeRules("${fideValueRule.getPSDEFormItemName()?lower_case}").infoMessage, trigger: 'blur' },
              </#if>
            </#if>            
            </#list>
          </#if>
        ],
</#if>
        </#if>
        <#-- 表单项 end -->
        <#-- 复合表单项 start -->
    <#if formdetail.isCompositeItem?? && formdetail.isCompositeItem() && formdetail.getEditorType() != "USERCONTROL">
    ${formdetail.getName()}: [
        <#if formdetail.getPSDEFormItems?? && formdetail.getPSDEFormItems()??>
            <#list formdetail.getPSDEFormItems() as childFormItem>
                <#if ctrl.getPSDEFormItemVRs()??>
                    <#list ctrl.getPSDEFormItemVRs() as fideValueRule>
                        <#if childFormItem.getName()?lower_case == fideValueRule.getPSDEFormItemName()?lower_case>
                        <#-- 系统值规则 -->
              <#if fideValueRule.getPSSysValueRule()??>
                <#assign  valueRule = fideValueRule.getPSSysValueRule()/>
                <#if valueRule.getRuleType?? && valueRule.getRuleType()??>
                  <#if valueRule.getRuleType() == "REG">
            { <#if valueRule.getRegExCode?? && valueRule.getRegExCode()??>pattern: /${valueRule.getRegExCode()}/</#if><#if valueRule.getRuleInfo?? &&  valueRule.getRuleInfo()??>, message: '${valueRule.getRuleInfo()}'</#if>, trigger: 'change' },
                  <#elseif valueRule.getRuleType() == "SCRIPT">
            { <#if valueRule.getScriptCode?? && valueRule.getScriptCode()??>validator: (rule:any, value:any, callback:any) => { ${valueRule.getScriptCode()} }</#if><#if valueRule.getRuleInfo?? &&  valueRule.getRuleInfo()??>, message: '${valueRule.getRuleInfo()}'</#if>, trigger: 'change' },
                  </#if>
                </#if>
              </#if>
              <#-- 属性值规则 -->
              <#if fideValueRule.getCheckMode?? && fideValueRule.getCheckMode()?? && fideValueRule.getCheckMode() != 2 && fideValueRule.getPSDEFValueRule?? && fideValueRule.getPSDEFValueRule()??>
                <#assign  deRule = fideValueRule.getPSDEFValueRule()/>
            {validator:(rule:any, value:any)=>{return this.verifyDeRules("${fideValueRule.getPSDEFormItemName()?lower_case}").isPast},message: this.verifyDeRules("${fideValueRule.getPSDEFormItemName()?lower_case}").infoMessage, trigger: 'change' },
            {validator:(rule:any, value:any)=>{return this.verifyDeRules("${fideValueRule.getPSDEFormItemName()?lower_case}").isPast},message: this.verifyDeRules("${fideValueRule.getPSDEFormItemName()?lower_case}").infoMessage, trigger: 'blur' },
              </#if>
                        </#if>
                    </#list>
                </#if>
            </#list>
        </#if>
        ],
    </#if>
        <#-- 复合表单项end -->
        </#list>
        }
    }

    /**
     * 属性值规则
     *
     * @type {*}
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
     */
    public deRules:any = {
        <#if ctrl.getPSDEFormItemVRs?? && ctrl.getPSDEFormItemVRs()??>
        <#list ctrl.getPSDEFormItemVRs() as fideValueRule>
            <#if fideValueRule.getCheckMode?? && fideValueRule.getCheckMode()?? && fideValueRule.getCheckMode() != 2 && fideValueRule.getPSDEFValueRule?? && fideValueRule.getPSDEFValueRule()??>
                <#assign  deRule = fideValueRule.getPSDEFValueRule()/>
                <#if fideValueRule.getPSDEFormItemName?? && fideValueRule.getPSDEFormItemName()??>
                ${fideValueRule.getPSDEFormItemName()?lower_case}:[
                <#if deRule.getPSDEFVRGroupCondition?? && deRule.getPSDEFVRGroupCondition()?? && deRule.getPSDEFVRGroupCondition().getPSDEFVRConditions?? &&  deRule.getPSDEFVRGroupCondition().getPSDEFVRConditions()??>
                <#list deRule.getPSDEFVRGroupCondition().getPSDEFVRConditions() as condItem>
                    <@getDeRule condItem />
                </#list>
                </#if>],
                </#if>
            </#if>
        </#list>
        </#if>
    };

    /**
     * 详情模型集合
     *
     * @type {*}
     * @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
     */
    public detailsModel: any = {
        <#list ctrl.getAllPSDEFormDetails() as formdetail>
        ${formdetail.name}: ${P.getPartCode(formdetail, 'DETAIL_MODEL').code}
        </#list>
        <#if !ctrl.isNoTabHeader()>
        ${ctrl.name}: new FormTabPanelModel({ caption: '${ctrl.name}', detailType: 'TABPANEL', name: '${ctrl.name}', visible: true, isShowCaption: true, form: this, tabPages: [<#list ctrl.getPSDEFormPages() as formmenber><#if formmenber_index gt 0>, </#if>{ name: '${formmenber.name}', index: ${formmenber_index}, visible: <#if formmenber.getPSDEFDGroupLogic('PANELVISIBLE')??>false<#else>true</#if> }</#list>] }),
        </#if>
    };
<#assign resetFormDataCount = 0/>
<#list ctrl.getPSDEFormItems() as item>
<#if item.getResetItemName?? && item.getResetItemName()??>
<#assign resetFormDataCount += 1/>
</#if>
</#list>
<#if resetFormDataCount gt 0>

    /**
     * 重置表单项值
     *
     * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
     * @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
     */
    public resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
        <#list ctrl.getPSDEFormItems() as item>
        <#if item.getResetItemName?? && item.getResetItemName()??>
        if (Object.is(name, '${item.getResetItemName()}')) {
            this.onFormItemValueChange({ name: '${item.getName()}', value: null });
            <#if item.getValueItemName()?? && item.getValueItemName() != ''>
            this.onFormItemValueChange({ name: '${item.getValueItemName()}', value: null });
            </#if>
        }
        </#if>
        </#list>
    }
</#if>
<#assign formLogicCount = 0/>
<#if ctrl.getPSDEFormItems()??>
<#list ctrl.getPSDEFormItems() as formitem>
<#if formitem.getPSDEFormItemUpdate()??>
<#assign formLogicCount += 1/>
</#if>
</#list>
</#if>
<#if formLogicCount gt 0 || P.getPartCode(item,'FORM_LOGIC').code?trim != "">

    /**
     * 表单项逻辑
     *
     * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
     * @returns {Promise<void>}
     * @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
     */
    public async formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): Promise<void> {
        <#if P.getPartCode(item,'FORM_LOGIC').code?length gt 0>
        ${P.getPartCode(item,'FORM_LOGIC').code}
        </#if>
        <#if ctrl.getPSDEFormItems()??>
        <#list ctrl.getPSDEFormItems() as formitem>
        <#if formitem.getPSDEFormItemUpdate()??>
        <#assign itemUpdate=formitem.getPSDEFormItemUpdate()/>
        if (Object.is(name, '${formitem.name}')) {
            const details: string[] = [<#list itemUpdate.getPSDEFIUpdateDetails() as detail><#if detail_index gt 0>, </#if>'${detail.getPSDEFormDetailName()?lower_case}'</#list>];
            this.updateFormItems('${itemUpdate.getPSAppDEMethod().getCodeName()}', this.data, details, ${itemUpdate.isShowBusyIndicator()?c});
        }
        </#if>
        </#list>
        </#if>
    }
</#if>
<#list ctrl.getAllPSDEFormDetails() as formdetail>
    <#if formdetail.getDetailType?? && formdetail.getDetailType() == 'BUTTON'>
    <#if formdetail.getActionType?? && formdetail.getActionType()??>
    <#if formdetail.getActionType() == 'UIACTION'>

	/**
	 * 表单 ${formdetail.getCaption()} 事件
	 *
	 * @memberof @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
	 */
    public ${formdetail.getName()}_click($event: any): void {
        <#if formdetail.getPSUIAction?? && formdetail.getPSUIAction()??>
        <#assign uiaction = formdetail.getPSUIAction()>
        this.${ctrl.name?lower_case}_${formdetail.getName()?lower_case}_click(null, null, $event);
        </#if>

    }
    </#if>
    <#if formdetail.getActionType() == 'FIUPDATE'>

	/**
	 * 表单 ${formdetail.getCaption()} 事件
	 *
	 * @memberof @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
	 */
    public ${formdetail.getName()}_click($event: any): void {
    <#assign itemUpdate=formdetail.getPSDEFormItemUpdate()/>
    <#if formdetail.getParamPickupPSAppView()??>
        <#assign dataview = formdetail.getParamPickupPSAppView()>
        <#--  BEGIN：是否应用实体视图  -->
        <#if dataview.isPSDEView()>
        const deResParameters: any[] = [
            <#--  BEGIN：存在父关系路径  -->
            <#if dataview.getPSAppDERSPathCount() gt 0>
            <#list dataview.getPSAppDERSPath(dataview.getPSAppDERSPathCount() - 1) as deRSPath>
            <#assign majorPSAppDataEntity = deRSPath.getMajorPSAppDataEntity()/>
            { pathName: '${srfpluralize(majorPSAppDataEntity.codeName)?lower_case}', parameterName: '${majorPSAppDataEntity.getCodeName()?lower_case}' },
            </#list>
            </#if>
            <#--  END：存在父关系路径  -->
        ];
        <#else>
        const deResParameters: any[] = [];
        </#if>
        <#--  END：是否应用实体视图  -->
        <#--  BEGIN：是否应用实体视图  -->
        <#if dataview.isPSDEView()>
        <#assign appDataEntity = dataview.getPSAppDataEntity()/>
        const parameters: any[] = [
            { pathName: '${srfpluralize(appDataEntity.codeName)?lower_case}', parameterName: '${appDataEntity.getCodeName()?lower_case}' },
        ];
        <#else>
        const parameters: any[] = [];
        </#if>
        <#--  END：是否应用实体视图  -->
        const view: any = {
            viewname: '${srffilepath2(dataview.getCodeName())}',
            title: this.<@getViewLanguageTitle dataview />,
            height: ${dataview.getHeight()?c},
            width: ${dataview.getWidth()?c},
            <#if formdetail.getParamViewParamJO()??>
            paramjo: ${formdetail.getParamViewParamJO()},
            </#if>
        }
        const data: any = {};
        if(view.paramjo) {
            Object.keys(view.paramjo).every((name: string) => {
                if (!name) {
                    return true;
                }
                let value: string = view.paramjo[name];
                if (value && value.startsWith('%') && value.endsWith('%')) {
                    const key: string = value.substring(1, value.length - 1);
                    if (!this.data.hasOwnProperty(key)) {
                        this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: `<#noparse>${(this.$t('app.formpage.desc1') as string)}${r'${key}'}，${(this.$t('app.formpage.desc2') as string)}</#noparse>` });
                        return false;
                    }
                    value = this.data[key];
                }
                Object.assign(data, { [name]: value });
                return true;
            });
        }
        let container: Subject<any> = this.$appmodal.openModal(view, this.context,data);
        container.subscribe((result: any) => {
            if (result && Object.is(result.ret, 'OK') && result.datas && Array.isArray(result.datas)) {
                const arg: any = { ...JSON.parse(JSON.stringify(this.data)) } ;
                Object.assign(arg, { srfactionparam: result.datas });
                const details: string[] = [<#list itemUpdate.getPSDEFIUpdateDetails() as detail><#if detail_index gt 0>, </#if>'${detail.getPSDEFormDetailName()?lower_case}'</#list>];
                this.updateFormItems('${itemUpdate.getPSAppDEMethod().getCodeName()}', arg, details, ${itemUpdate.isShowBusyIndicator()?c});
            }
        });
    <#else>
        const details: string[] = [<#list itemUpdate.getPSDEFIUpdateDetails() as detail><#if detail_index gt 0>, </#if>'${detail.getPSDEFormDetailName()?lower_case}'</#list>];
        this.updateFormItems('${itemUpdate.getPSAppDEMethod().getCodeName()}', this.data, details, ${itemUpdate.isShowBusyIndicator()?c});
    </#if>
    }
    </#if>
    </#if>
    </#if>
</#list>
<#--  计算分组界面行为事件是否存在  -->
<#assign groupUIActionClickCount = 0/>
<#list ctrl.getAllPSDEFormDetails() as formdetail>
<#if formdetail.getDetailType?? && formdetail.getDetailType() == 'GROUPPANEL'>
<#if formdetail.getPSUIActionGroup()??>
<#list formdetail.getPSUIActionGroup().getPSUIActionGroupDetails() as uadetails>
<#assign groupUIActionClickCount += 1/>
</#list>
</#if>
</#if>
</#list>
<#if groupUIActionClickCount gt 0>

    /**
     * 分组界面行为事件
     *
     * @param {*} $event
     * @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
     */
    public groupUIActionClick($event: any): void {
        if (!$event) {
            return;
        }
        const item: any = $event.item;
        <#list ctrl.getAllPSDEFormDetails() as formdetail>
        <#if formdetail.getDetailType?? && formdetail.getDetailType() == 'GROUPPANEL'>
        <#if formdetail.getPSUIActionGroup()??>
        <#list formdetail.getPSUIActionGroup().getPSUIActionGroupDetails() as uadetails>
        if (Object.is(item.name, '${formdetail.getName()}_${uadetails.getName()}')) {
            this.${ctrl.name}_${formdetail.getName()}_${uadetails.getName()}_click(null, null, $event.event);
        }
        </#list>
        </#if>
        </#if>
        </#list>
    }
</#if>
<#--  计算新建默认值是否存在  -->
<#assign createDefaultCount = 0/>
<#list ctrl.getAllPSDEFormDetails() as formdetail>
<#if (formdetail.getCreateDV?? || formdetail.getCreateDVT??) && (formdetail.getCreateDV()?? || formdetail.getCreateDVT()??)>
<#if !(formdetail.getCreateDV() == '') || !(formdetail.getCreateDVT() == '')>
<#assign createDefaultCount += 1/>
</#if>
</#if>
</#list>
<#if createDefaultCount gt 0>

    /**
     * 新建默认值
     * @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
     */
    public createDefault(){                    
        <#list ctrl.getAllPSDEFormDetails() as formdetail><#t>
        <#if (formdetail.getCreateDV?? || formdetail.getCreateDVT??) && (formdetail.getCreateDV()?? || formdetail.getCreateDVT()??) && (formdetail.getCreateDV() !="" || formdetail.getCreateDVT() != "")><#t>
        if (this.data.hasOwnProperty('${formdetail.getCodeName()?lower_case}')) {
        <#if !(formdetail.getCreateDVT() == '')><#t>
        <#-- 网页请求 -->
        <#if formdetail.getCreateDVT() == 'CONTEXT'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.viewparams['${formdetail.getCreateDV()}'];
        <#-- 用户全局对象 -->
        <#elseif formdetail.getCreateDVT() == 'SESSION'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.context['${formdetail.getCreateDV()}'];
         <#-- 当前应用数据 -->
        <#elseif formdetail.getCreateDVT() == 'APPDATA'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.context['${formdetail.getCreateDV()}'];
        <#-- 当前操作用户(名称) -->
        <#elseif formdetail.getCreateDVT() == 'OPERATORNAME'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.context['srfusername'];
        <#-- 当前操作用户(编号) -->
        <#elseif formdetail.getCreateDVT() == 'OPERATOR'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.context['srfuserid'];
        <#-- 当前时间 -->
        <#elseif formdetail.getCreateDVT() == 'CURTIME'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.$util.dateFormat(new Date());
        <#-- 数据对象属性 -->
        <#elseif formdetail.getCreateDVT() == 'PARAM'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.service.getRemoteCopyData().${formdetail.getCreateDV()}?this.service.getRemoteCopyData().${formdetail.getCreateDV()}:null;
        </#if>
        <#else>
        <#-- 默认值 -->
            <#assign datatype=srfjavatype(formdetail.getStdDataType())>
            this.data['${formdetail.getCodeName()?lower_case}'] = <#if datatype=='BigInteger' || datatype=='Integer' || datatype=='Double' || datatype=='Decimal' || datatype=='Float' || datatype=='BigDecimal'>${formdetail.getCreateDV()}<#else>'${formdetail.getCreateDV()}'</#if>;
        </#if>
        }
        </#if>
        </#list>
    }
</#if>
<#--  计算更新默认值是否存在  -->
<#assign updateDefaultCount = 0/>
<#list ctrl.getAllPSDEFormDetails() as formdetail>
<#if (formdetail.getUpdateDV?? || formdetail.getUpdateDVT??) && (formdetail.getUpdateDV()?? || formdetail.getUpdateDVT()??)>
<#if !(formdetail.getUpdateDV() == '') || !(formdetail.getUpdateDVT() == '')>
<#assign updateDefaultCount += 1/>
</#if>
</#if>
</#list>
<#if updateDefaultCount gt 0>

    /**
     * 更新默认值
     * @memberof ${srfclassname(ctrl.codeName)}${srfclassname(ctrl.getControlType()?lower_case)}Base
     */
    public updateDefault(){                    
        <#list ctrl.getAllPSDEFormDetails() as formdetail><#t>
        <#if (formdetail.getUpdateDV?? || formdetail.getUpdateDVT??) && (formdetail.getUpdateDV()?? || formdetail.getUpdateDVT()??) && (formdetail.getUpdateDV() != "" || formdetail.getUpdateDVT() != "")><#t>
        if (this.data.hasOwnProperty('${formdetail.getCodeName()?lower_case}') && !this.data.${formdetail.getCodeName()?lower_case}) {
        <#if !(formdetail.getUpdateDVT() == '')><#t>
        <#-- 网页请求 -->
        <#if formdetail.getUpdateDVT() == 'CONTEXT'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.viewparams['${formdetail.getUpdateDV()}'];
        <#-- 用户全局对象 -->
        <#elseif formdetail.getUpdateDVT() == 'SESSION'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.context['${formdetail.getUpdateDV()}'];
         <#-- 当前应用数据 -->
        <#elseif formdetail.getUpdateDVT() == 'APPDATA'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.context['${formdetail.getUpdateDV()}'];
        <#-- 当前操作用户(名称) -->
        <#elseif formdetail.getUpdateDVT() == 'OPERATORNAME'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.context['srfusername'];
        <#-- 当前操作用户(编号) -->
        <#elseif formdetail.getUpdateDVT() == 'OPERATOR'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.context['srfuserid'];
        <#-- 数据对象属性 -->
        <#elseif formdetail.getUpdateDVT() == 'PARAM'>
            this.data['${formdetail.getCodeName()?lower_case}'] = this.service.getRemoteCopyData().${formdetail.getUpdateDV()}?this.service.getRemoteCopyData().${formdetail.getUpdateDV()}:null;
        </#if>
        <#else>
        <#-- 默认值 -->
            <#assign datatype=srfjavatype(formdetail.getStdDataType())>
            this.data['${formdetail.getCodeName()?lower_case}'] = <#if datatype=='BigInteger' || datatype=='Integer' || datatype=='Double' || datatype=='Decimal' || datatype=='Float' || datatype=='BigDecimal'>${formdetail.getUpdateDV()}<#else>'${formdetail.getUpdateDV()}'</#if>;
        </#if>
        }
        </#if>
        </#list>
    }
</#if>
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude>